<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * Admin library
 * การทำงานพื้นฐานต่างๆที่ใช้งานใน admin section
 * @package MainLibrary
 * @subpackage AdminLib
 * @category main
 * @author BeYourCyber
 * @version 1.0
 */
class Adminlib {

    var $modulestate = '';
    var $admin_page = 'admin_page';

    function set_modulestate() {
        $this->modulestate['10'] = 'Installed (not active)';
        $this->modulestate['20'] = 'Active';
        return $this->modulestate;
    }

    function set_reserve_module() {
        $reserve['Admin'] = TRUE;
        return $reserve;
    }

    function get_admin_page() {
        $CI =& get_instance();
        if( $data = $CI->cache->get('admin_page', 'admin') ){
            return $data;
        } else {
            $s = 'SELECT modulename FROM ' . $this->admin_page . '';
            $s = mysql_query($s);
            if (mysql_num_rows($s) > 0) {
                $data = array();
                $data[0] = "";
                while ($t = mysql_fetch_assoc($s)) {
                    $data[] = $t;
                }
                unset($data[0]);
                $CI->cache->save('admin_page', $data , 'admin');
                return $data;
            } else {
                return FALSE;
            }
        }
        
    }

}

?>